package org.hhchat.others.toutiao.p2018;

import java.util.Scanner;

/**
 * Created this one by huminghao on 2018/4/15.
 */
public class Toutiao02 {

    static int[] dp;
    static int count = 0;

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n1 = in.nextInt();
        int n2 = in.nextInt();
        int m = in.nextInt();
        int[] a = new int[n1];
        int[] b = new int[n2];

        for (int i = 0; i < n1; i++) {
            a[i] = in.nextInt();
        }
        count %= 1000000007;

        int subAns = 0;
        dp = new int[m + 1];
        dp[0] = 1;

        for (int anA : a) {
            for (int j = anA; j < m + 1; j++) {
                dp[j] %= 1000000007;
                dp[j] += dp[j - anA] % 1000000007;
            }
        }
        subAns = dp[m];

        count += subAns % 1000000007;
        count %= 1000000007;
        for (int j = 0; j < n2; j++) {
            b[j] = in.nextInt();
            if (m - b[j] >= 0) {
                count %= 1000000007;
                count += dp[m - b[j]] % 1000000007;
                count %= 1000000007;
            }
        }

        System.out.println(count % 1000000007);

    }



}
